# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=libktorrent
pkgver=23.08.4
pkgrel=0
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://kde.org/applications/internet/org.kde.ktorrent"
pkgdesc="A powerful BitTorrent client for KDE"
license="GPL-2.0-or-later"
depends_dev="
	boost-dev
	gmp-dev
	karchive5-dev
	kcrash5-dev
	ki18n5-dev
	kio5-dev
	qca-dev
	qt5-qtbase-dev
	solid5-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	samurai
	"
checkdepends="xvfb-run"
_repo_url="https://invent.kde.org/network/libktorrent.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/libktorrent-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	# utppolltest requires network access
	# superseedtest is broken
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "(utppoll|superseed)test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
9546ac6252f85eb12e2ad870d7da25e08ede1aab917e2bb8237cd5e975b1fe0d99ecfbbdda40a807ac96ebe23830cffbea59ebfac8d4e53b487520d7bf67ffbc  libktorrent-23.08.4.tar.xz
"
